using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using FrameWork.Source.Object_Classes;
using FrameWork.Source.Texture;

namespace FrameWork.Source.CMenu_class
{
    class CMenuItem : CObject
    {
        /// <summary>
        /// Is this Item active or not
        /// If active : full update and draw this item
        /// If non - active : Not update and draw this item
        /// </summary>
        public bool m_isActive { get; set; }

        /// <summary>
        /// Index of this item
        /// </summary>
        public int m_nIndex { get; set; }

        /// <summary>
        /// Name of this item
        /// </summary>
        public string m_strName { get; set; }

        public CMenuItem()
            : base()
        {
            m_nIndex = -1;
            m_strName = "";
        }


        /// <summary>
        /// Create new item based on index
        /// </summary>
        /// <param name="index">Index of this item</param>
        /// <param name="pImage">Image of this item , if not pass null</param>
        /// <param name="width">Width of this item</param>
        /// <param name="height">Height of this item</param>
        /// <param name="position">Position of this item</param>
        /// <param name="isActive">Is this item active or not</param>
        public void createItem(int index, CTexture pImage, int width, int height, Vector2 position, bool isActive)
        {
            m_nIndex = index;
            setImage(pImage, width, height);
            m_vec2Position = position;
            m_isActive = isActive;
        }

        /// <summary>
        /// Create new item based on name
        /// </summary>
        /// <param name="itemName">Name of this item</param>
        /// <param name="pImage">Image of this item , if not pass null</param>
        /// <param name="width">Width of this item</param>
        /// <param name="height">Height of this item</param>
        /// <param name="position">Position of this item</param>
        /// <param name="isActive">Is this item active or not</param>
        public void createItem(string itemName, CTexture pImage, int width, int height, Vector2 position, bool isActive)
        {
            m_strName = itemName;
            setImage(pImage, width, height);
            m_vec2Position = position;
            m_isActive = isActive;
        }

        /// <summary>
        /// Update our item over time
        /// </summary>
        /// <param name="deltaTime"></param>
        public override void update(float deltaTime)
        {

        }


        /// <summary>
        /// Draw our item into screen
        /// </summary>
        public override void draw()
        {
            if (m_isActive)
                base.draw();
        }

        /// <summary>
        /// Is our item picking or not
        /// </summary>
        /// <param name="pickX">X position of touch</param>
        /// <param name="pickY">Y position of touch</param>
        /// <returns>True if it had been picked , false if not</returns>
        public bool picking(int pickX, int pickY)
        {
            if (!m_isActive)
                return false;
            return getBoundBox().Contains(new Point(pickX, pickY));
        }
    }
}
